package carclockpack;

import java.util.Calendar;

public class YearSetupState implements ClockSetupState {
    private ClockSetup clockSetup;
    private int year;
 
    public YearSetupState(ClockSetup clockSetup) {
        this.clockSetup = clockSetup;
        year = Calendar.getInstance().get(Calendar.YEAR);
    }
 
    public void previousValue() {
        year--;
    }
 
    public void nextValue() {
        year++;
    }
 
    public void selectValue() {
        System.out.println("Year set to " + year);
        clockSetup.setState(clockSetup.getMonthSetupState());
    }
 
    public String getInstructions() {
        return "Please set the year...";
    }
 
    public int getSelectedValue() {
        return year;
    }
}
